1. Field of the Invention
The present invention relates to memory management and more particularly to page swapping in virtual memory during memory management.
2. Description of the Related Art
In computing, virtual memory is a memory management technique developed for multitasking kernels. In virtual memory management schemes, the various forms of computer data storage such as random-access memory and disk storage can be virtualized, allowing a computer program to be designed as though there is only one type of memory—“virtual” memory—that behaves just as directly addressable read/write random access memory (RAM). Computer systems employing virtual memory use hardware memory more efficiently than systems without virtual memory and make the programming of applications easier by hiding memory fragmentation, by delegating to the kernel the burden of managing the memory hierarchy and by obviating the need to relocate program code or to access memory with relative addressing.
Memory virtualization is a generalization of the concept of virtual memory. A technique used by virtual memory operating systems to ensure that requested data can be made available as quickly as possible. In memory virtualization, the operating system copies a certain number of memory pages from main memory to disk. When a program requires data residing within a page of memory not present in main memory, the operating system copies the required page from disk storage into memory while “swapping” another page already in main memory back to the disk storage. Within the art, the act of writing a page of memory from disk storage to main memory is known as “paging in” while the act of writing a page of memory from main memory to disk storage is known as “paging out”.
The determination of which memory page to page out during a memory swapping operation generally is not random. Rather, a number of algorithms exist for determining which memory pages are to be subject to paging out during memory swapping. For example, it is known in the art to apply the least recently used (LRU) algorithm during memory swapping in which the least frequently used memory page is selected for paging out. More specifically, when the number of free frames in real memory falls below a certain threshold the virtual memory manager invokes an LRU daemon, which applies an LRU algorithm to select pages in main memory for paging out to disk.
As it is well known in the art, invoking the LRU algorithm can involve a degree of performance overhead as the page-replacement object code cycles through the page frame table (PFT) examining each reference bit for each page. If the page is unreferenced and is “stealable” and not pinned, then the page is placed on the “free list”. If the page is not modified the page can be immediately placed on the free list. Otherwise the page is placed on the input/output (I/O) list for a page out. Thus, the LRU algorithm can consume significant processing cycles in identifying the page or pages to steal. Additionally, paging in and out to fixed storage can impose a significant performance overhead because of I/O latency to fixed storage.